package com.afalon.cloud.contracts.competition;

import java.net.URI;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@PersistenceCapable
@XmlRootElement(name = "league")
@XmlAccessorType(XmlAccessType.NONE)
public class League {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key leagueKey;
	
	@XmlElement
	@Persistent
	private String name;
	
	@XmlElement(name="leagueuri")
	public URI leagueUri;
	
	public League() 
	{
		
	}

	public Key getLeagueKey() {
		return leagueKey;
	}
	
	@XmlElement(name="leagueid")
	public String getLeagueId() {
		return KeyFactory.keyToString(this.getLeagueKey());
	}
		
	public void setName(String value) {
		name = value;
	}

	public String getName() {
		return name;
	}
	
}
